package com.p2p.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.p2p.model.entity.Userinfo;
import com.p2p.model.vo.SysUserQueryVo;
import com.p2p.system.mapper.UserinfoMapper;
import com.p2p.system.service.UserinfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author 黄旭彬
 * @since 2023-12-10
 */
@Service
public class UserinfoServiceImpl extends ServiceImpl<UserinfoMapper, Userinfo> implements UserinfoService {
//    @Autowired
//    private UserinfoMapper userinfoMapper;

    @Override
    public IPage<Userinfo> selectPage(Page<Userinfo> pageParam, SysUserQueryVo sysUserQueryVo) {
        return this.baseMapper.selectUserPage(pageParam,sysUserQueryVo);
    }

    @Override
    public Userinfo getByEmail(String email) {

        QueryWrapper<Userinfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("email", email);
        Userinfo userinfo = this.baseMapper.selectOne(queryWrapper);

        return userinfo;
    }

    @Override
    public com.p2p.system.entity.Userinfo getByPhone(String phone) {


        return this.baseMapper.getByPhone(phone);
    }
}
